/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package descent;


import java.util.ArrayList;
import java.util.List;
import java.util.Random;
/**
 *
 * @author Luke
 */
public class Die {
    Random generator = new Random();   
    List<int[]> redDie = new ArrayList<int[]>();
    List<int[]> blueDie = new ArrayList<int[]>();
    List<int[]> whiteDie = new ArrayList<int[]>();
    List<int[]> greenDie = new ArrayList<int[]>();
    List<int[]> yellowDie = new ArrayList<int[]>();
    List<int[]> blackDie = new ArrayList<int[]>();
    List<int[]> clearDie = new ArrayList<int[]>();
    String dieColor;
    
    public Die(String color){
        if (color.toLowerCase()  == "red"){
            dieColor = "red";
            int[] sideOneRed = {0,4,0};
            int[] sideTwoRed = {2,2,0};
            int[] sideThreeRed = {2,1,1};
            int[] sideFourRed = {-1,-1,-1};
            int[] sideFiveRed = {1,3,0};
            int[] sideSixRed = {1,3,1};      
            redDie.add(sideOneRed);        
            redDie.add(sideTwoRed);
            redDie.add(sideThreeRed);
            redDie.add(sideFourRed);
            redDie.add(sideFiveRed);
            redDie.add(sideSixRed);
        } else if (color.toLowerCase() == "blue") {
            dieColor = "blue";
            int[] sideOneBlue = {3,1,1};
            int[] sideTwoBlue = {2,2,0};
            int[] sideThreeBlue = {4,0,1};
            int[] sideFourBlue = {3,1,1};
            int[] sideFiveBlue = {-1,-1,-1};
            int[] sideSixBlue = {1,2,0};       
            blueDie.add(sideOneBlue);        
            blueDie.add(sideTwoBlue);
            blueDie.add(sideThreeBlue);
            blueDie.add(sideFourBlue);
            blueDie.add(sideFiveBlue);
            blueDie.add(sideSixBlue);
        } else if (color.toLowerCase() == "white") {
            dieColor = "white";
            int[] sideOneWhite = {1,3,1};
            int[] sideTwoWhite = {3,1,1};
            int[] sideThreeWhite = {3,1,1};
            int[] sideFourWhite = {1,3,1};
            int[] sideFiveWhite = {2,2,0};
            int[] sideSixWhite = {-1,-1,-1};        
            whiteDie.add(sideOneWhite);        
            whiteDie.add(sideTwoWhite);
            whiteDie.add(sideThreeWhite);
            whiteDie.add(sideFourWhite);
            whiteDie.add(sideFiveWhite);
            whiteDie.add(sideSixWhite);
        } else if (color.toLowerCase() == "green") {
            dieColor = "green";
            int[] sideOneGreen = {0,3,0};
            int[] sideTwoGreen= {0,2,1};
            int[] sideThreeGreen = {0,3,0};
            int[] sideFourGreen = {0,2,1};
            int[] sideFiveGreen = {1,2,0};
            int[] sideSixGreen = {1,1,0};        
            greenDie.add(sideOneGreen);        
            greenDie.add(sideTwoGreen);
            greenDie.add(sideThreeGreen);
            greenDie.add(sideFourGreen);
            greenDie.add(sideFiveGreen);
            greenDie.add(sideSixGreen);
        } else if (color.toLowerCase() == "yellow") {
            dieColor = "yellow";
            int[] sideOneYellow = {1,1,0};
            int[] sideTwoYellow = {3,0,0};
            int[] sideThreeYellow = {2,1,0};
            int[] sideFourYellow = {3,0,0};  
            int[] sideFiveYellow = {2,0,1};
            int[] sideSixYellow = {2,0,1};       
            yellowDie.add(sideOneYellow);        
            yellowDie.add(sideTwoYellow);
            yellowDie.add(sideThreeYellow);
            yellowDie.add(sideFourYellow);
            yellowDie.add(sideFiveYellow);
            yellowDie.add(sideSixYellow);
        } else if (color.toLowerCase() == "black") {
            dieColor = "black";
            int[] sideOneBlack = {1,1,0};
            int[] sideTwoBlack = {1,1,0};
            int[] sideThreeBlack = {1,1,0};
            int[] sideFourBlack = {0,0,0}; // Blank  
            int[] sideFiveBlack = {0,0,1};
            int[] sideSixBlack = {0,0,1};       
            blackDie.add(sideOneBlack);        
            blackDie.add(sideTwoBlack);
            blackDie.add(sideThreeBlack);
            blackDie.add(sideFourBlack);
            blackDie.add(sideFiveBlack);
            blackDie.add(sideSixBlack);           
        } else if (color.toLowerCase() == "clear") {
            dieColor = "clear";
            int[] sideOneClear = {0,0,0};
            int[] sideTwoClear = {0,0,0};
            int[] sideThreeClear = {-1,-1,-1};
            int[] sideFourClear = {0,0,0};  
            int[] sideFiveClear = {0,0,0};
            int[] sideSixClear = {-1,-1,-1};       
            clearDie.add(sideOneClear);        
            clearDie.add(sideTwoClear);
            clearDie.add(sideThreeClear);
            clearDie.add(sideFourClear);
            clearDie.add(sideFiveClear);
            clearDie.add(sideSixClear);     
        }
    }
    
    public int[] Roll(){          
        int index = 0;
        index = generator.nextInt(6);
        System.out.println("Color: " + dieColor + " , " + "Index: " + index);
        if (dieColor.toLowerCase()  == "red"){
            return redDie.get(index);
        } else if (dieColor.toLowerCase() == "blue") {
            return blueDie.get(index);
        } else if (dieColor.toLowerCase() == "white") {
            return whiteDie.get(index);
        } else if (dieColor.toLowerCase() == "green") {
            return greenDie.get(index);
        } else if (dieColor.toLowerCase() == "yellow") {
            return yellowDie.get(index);
        } else if (dieColor.toLowerCase() == "black") {
            return blackDie.get(index);          
        } else if (dieColor.toLowerCase() == "clear") {
            return clearDie.get(index);     
        } else {
            return null;
        }
    }
 
}
   
    
    




    /*public static void main(String args[])
    {
        int totalWounds, totalRange, totalSurges;
        int[] sideUp;
        
        Die red = new Die("red");
        sideUp = red.Roll();        
        System.out.println("Range: " + sideUp[0] + " , " + "Wounds: " + sideUp[1] + " , " + "Surges: " + sideUp[2]);

        Die white = new Die("white");
        sideUp = white.Roll();       
        System.out.println("Range: " + sideUp[0] + " , " + "Wounds: " + sideUp[1] + " , " + "Surges: " + sideUp[2]);
        
        Die black = new Die("black");
        sideUp = black.Roll();
        System.out.println("Range: " + sideUp[0] + " , " + "Wounds: " + sideUp[1] + " , " + "Surges: " + sideUp[2]);
   
        
    }*/
    


